//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<XDemoApp.h>
///	@path	~/src/xdemo/
///	@date	2007/10/17
///	@desc	XDemo application class.

#pragma once

#include "xeres.h"

#include "database/store/IFileSystem.h"

#include "scene/ICamera.h"

#include "appear/app/key_map.h"
#include "appear/xwin/GameApp.h"
#include "appear/xwin/GameDebug.h"
#include "appear/xwin/UiManager.h"

namespace xeres
{
	/*!
		\class	XDemoApp
		\brief	This class demonstrates how to establish xeres engine,
				and how to setup scenarios.
				Follow this demo users can create their own demos or games.
				There's another way of configurating engine, by external XML files and scripts.
	*/
	class XDemoApp : public GameApp
	{
	public:

		/// \ctor
		XDemoApp( HWND hWnd );

		/// \dtor
		virtual ~XDemoApp( void );

	//@ interface

		/*!
			\brief		Call to perform application initialization.
						Usually application should load settings and
						prepare resources at this time.
			\return		Result of initialization.
						If failed, application will terminate.
		*/
		virtual bool Initialize( void );

		/*!
			\brief		Clean up application & save settings or informations.
		*/
		virtual void Finalize( void );

	private:

		friend class XDemoInitHelper;

	//@ data

		// window handle
		HWND				m_hWnd;

		// input handler	
		InputHandler *		m_inputHandler;
		InputDispatcher *	m_inputDispatcher;
		MessageFilter *		m_inputFilter;
		MessageFilter *		m_regularFilter;
		Ticker *			m_inputTicker;

		// game debugger
		GameDebug *			m_debugger;

		// ui manager
		UiManager			m_ui;
		
		// settings
		Ref<IFileSystem>	m_etc;

		// resource
		Ref<IFileSystem>	m_res;

		// camera
		Ref<ICamera>		m_camera;

		// application hot key
		KeyMap				m_hotkey;
	};

} // namespace xeres
